//
//  LTFReadDetailViewController.m
//  NeteaseNews
//
//  Created by liutaifeng on 16/4/23.
//  Copyright © 2016年 liutaifeng. All rights reserved.
//

#import "LTFReadDetailViewController.h"
#import "LTFReadDetailView.h"
#import "ReadSpecificViewController.h"
@interface LTFReadDetailViewController ()
<
 LTFReadDetailViewDelegate
>
@property (nonatomic, retain) LTFReadDetailView *detailView;
@property (nonatomic, retain) UIView *myView;
@property (nonatomic, retain) UIButton *button;
@property (nonatomic, retain) UILabel *label;
@end

@implementation LTFReadDetailViewController




- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self createView];
}

- (void)createView {
    self.detailView = [[LTFReadDetailView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height - 64 - 48)];
    [self.view addSubview:_detailView];
    [_detailView release];
    _detailView.string = self.string;
    self.detailView.delegate = self;
    self.myView = [[UIView alloc] initWithFrame:CGRectMake(0, 24, self.view.frame.size.width, 40)];
    [self.navigationController.view addSubview:_myView];
    [_myView release];
    _myView.backgroundColor = [UIColor lightGrayColor];
    
    self.button = [UIButton buttonWithType:UIButtonTypeSystem];
    _button.frame = CGRectMake(0, 0, 40, 40);
    
    [_button setImage:[UIImage imageNamed:@"fanhui.png"] forState:UIControlStateNormal];
    [_myView addSubview:_button];
    _button.tintColor = [UIColor whiteColor];
    [_button addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
    
    self.label = [[UILabel alloc] initWithFrame:CGRectMake(155, 0, 100, 40)];
    [_myView addSubview:_label];
    _label.textColor = [UIColor whiteColor];
    _label.text = self.str;
    
}


- (void)click:(UIButton *)button {
    [self.navigationController popViewControllerAnimated:YES];
    
}

- (void)viewWillDisappear:(BOOL)animated {
    [_myView removeFromSuperview];
}
- (void)viewWillAppear:(BOOL)animated {
    [self.navigationController.view addSubview:self.myView];
}

- (void)sendString:(NSString *)string{
    ReadSpecificViewController *specificVC = [[ReadSpecificViewController alloc] init];
    [self.navigationController pushViewController:specificVC animated:YES];
    specificVC.string = string;
    [specificVC release];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
@end
